package com.jxw.launcher.view;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Point;
import android.os.Bundle;
import android.text.Html;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;
import com.jxw.launcher.R;
import com.jxw.update.UpdateActivity;

/* loaded from: classes.dex */
public class DialogUpdate extends Dialog {
    private String count;
    private OnConfirmClickListener onConfirmClickListener;
    private TextView tv_cancel;
    private TextView tv_confirm;
    private TextView tv_text;

    /* loaded from: classes.dex */
    public interface OnConfirmClickListener {
        void onClick();
    }

    public void setOnConfirmClickListener(OnConfirmClickListener onConfirmClickListener) {
        this.onConfirmClickListener = onConfirmClickListener;
    }

    public DialogUpdate(Context context, String str) {
        super(context, R.style.Theme_Transparent);
        this.count = str;
    }

    @Override // android.app.Dialog
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.dialog_update_tx);
        Display defaultDisplay = getWindow().getWindowManager().getDefaultDisplay();
        WindowManager.LayoutParams attributes = getWindow().getAttributes();
        Point point = new Point();
        defaultDisplay.getSize(point);
        double d = point.x;
        Double.isNaN(d);
        attributes.width = (int) (d * 0.8d);
        getWindow().setAttributes(attributes);
        setCanceledOnTouchOutside(false);
        setCancelable(false);
        getWindow().setDimAmount(0.7f);
        initView();
    }

    private void initView() {
        this.tv_text = (TextView) findViewById(R.id.tv_text);
        this.tv_text.setText(Html.fromHtml("检查到有 <font color=\"#01B9FF\">" + this.count + "</font> 个应用更新"));
        this.tv_confirm = (TextView) findViewById(R.id.tv_confirm);
        this.tv_cancel = (TextView) findViewById(R.id.tv_cancel);
        this.tv_confirm.setOnClickListener(new View.OnClickListener() { // from class: com.jxw.launcher.view.DialogUpdate.1
            @Override // android.view.View.OnClickListener
            public void onClick(View view) {
                if (DialogUpdate.this.onConfirmClickListener != null) {
                    DialogUpdate.this.onConfirmClickListener.onClick();
                }
                DialogUpdate.this.getContext().startActivity(new Intent(DialogUpdate.this.getContext(), UpdateActivity.class));
                DialogUpdate.this.dismiss();
            }
        });
        this.tv_cancel.setOnClickListener(new View.OnClickListener() { // from class: com.jxw.launcher.view.DialogUpdate.2
            @Override // android.view.View.OnClickListener
            public void onClick(View view) {
                DialogUpdate.this.dismiss();
            }
        });
    }
}
